package boerseTest.mainTest.AccountTest;

import boerse.main.Account.AccountManagerImpl;
import boerse.main.Exceptions.NegativeValueException;
import boerse.main.StockPriceProvider.RandomStockPriceProvider;
import boerse.main.StockPriceProvider.StockPriceInfo;
import org.junit.Before;
import org.junit.Test;

import java.io.IOException;

import static org.junit.Assert.assertEquals;

public class AccountManagerImplTest {

	private AccountManagerImpl manager;
	
	@Before
	public void setUp() throws IOException {
		StockPriceInfo stockPrice = new RandomStockPriceProvider();
		manager = new AccountManagerImpl(stockPrice);
		manager.createPlayer("Hans");
	}
	
	
//	@Test
//	public void testGetPlayer() {
//		assertEquals("Player Hans should exists", "Hans", manager.getPlayer("Hans"));
//	}
	
	@Test
	public void testGetCashAccountPrice() {
		try {
			manager.addMoney("Hans", 1000);
		} catch (NegativeValueException e) {
			e.printStackTrace();
		}
		assertEquals("Hans should have 1000 cent", 1000, manager.getCashAccountPrice("Hans"));
	}
}
